<!-- 配种 -->
<template>
	<view class="BreedingManagement">
		<view class="th"></view>
		<view class="item" v-for="(item, index) in data" :key="index">
			<view class="item-Public">
				<view class="item-left">
					<image src="@/static/imgs/cow.png" style="width: 70rpx;height: 70rpx;"></image>
					<view class="item-naber">
						<view>公：牲畜编号</view>
						<view>IMEI:{{item.F_Paternal_IMEI}}</view>
					</view>
				</view>
				<view class="item-right">
					<i class="iconfont icon-xiangyoujiantou"></i>
				</view>
			</view>
			<view class="item-Mother">
				<view class="item-left">
					<image src="@/static/imgs/cow.png" style="width: 70rpx;height: 70rpx;"></image>
					<view class="item-naber">
						<view>母：牲畜编号</view>
						<view>IMEI:{{item.F_Matriarchal_IMEI}}</view>
					</view>
				</view>
				<view class="item-right">
					<i class="iconfont icon-xiangyoujiantou"></i>
				</view>
			</view>
			<view class="item-footer">
				<view>操作员：{{item.F_UserName}}</view>
				<view>{{formatTime(item.F_CreateTime)}}</view>
			</view>
		</view>
		<navigator url="/pages/management/child/breeding/AddBreedingManagement">
			<button class="btn">新增</button>
		</navigator>
	</view>
</template>

<script setup>
	import {
		ref,
		onMounted
	} from 'vue'
	import {
		getBreed
	} from '@/utils/api/Management.js'
	import dayjs from 'dayjs'
	const data = ref(null)

	const list = async () => {
		let res = await getBreed({
			page: 1,
			pageSize: 100
		})
		data.value = res.data
	}

	onMounted(() => {
		list()
	})

	//日期转换函数
	const formatTime = (time) => {
		return dayjs(time).format('YYYY-MM-DD HH:mm:ss');
	}
</script>

<style scoped>
	@import '@/static/iconfont/iconfont.css';

	.th {
		height: 20rpx;
	}

	.BreedingManagement {
		width: 100%;
		height: 100%;
		background-color: #F3F5F8;
	}

	.item {
		width: 90%;
		margin: 20rpx auto;
		height: 340rpx;
		background-color: #fff;
		border-radius: 10rpx;
		display: flex;
		flex-direction: column;
	}

	.item-Public {
		flex: 1;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.item-Mother {
		flex: 1;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.item-left {
		display: flex;
		align-items: center;
		margin-left: 40rpx;
	}

	.item-right {
		margin-right: 40rpx;
	}

	.item-naber {
		margin-left: 20rpx;
	}

	.item-footer {
		height: 70rpx;
		display: flex;
		justify-content: space-between;
		padding: 0 40rpx;
		line-height: 70rpx;
		border-top: 1rpx solid #ccc;
	}

	.btn {
		width: 100%;
		height: 90rpx;
		background-color: #0BCB75;
		position: fixed;
		/* 添加固定定位 */
		bottom: 0;
		/* 固定在屏幕底部 */
		left: 0;
		/* 水平方向居左对齐，如果要水平居中可通过其他方式调整 */
		z-index: 999;
		/* 确保按钮在其他元素之上显示，避免被遮挡 */
	}
</style>